-
Notifications
You must be signed in to change notification settings - Fork 81
Add packed virtqueue support #301
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
Signed-off-by: Prakash Shekhar <[email protected]>
Signed-off-by: Prakash Shekhar <[email protected]>
Signed-off-by: Prakash Shekhar <[email protected]>
Signed-off-by: Prakash Shekhar <[email protected]>
Bump virtio-queue from v0.14.0 to v0.15.0 Bump virtio-bindings from v0.2.1 to v0.2.5 Signed-off-by: Jinank Jain <[email protected]> Signed-off-by: Prakash Shekhar <[email protected]>
This release upgraded virtio-queue and virtio-bindings to latest released version. Signed-off-by: Jinank Jain <[email protected]> Signed-off-by: Prakash Shekhar <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@prakash-shekhar please instead of merge main, can you rebase?
Also please write better commit messages with description other than title, explaining the why of changes.
vhost/src/vhost_kern/mod.rs
Outdated
#[cfg(feature = "vhost-user")] | ||
let is_packed = config_data.flags & VhostUserVringAddrFlags::VHOST_VRING_F_PACKED.bits() != 0; | ||
#[cfg(not(feature = "vhost-user"))] | ||
let is_packed = false; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe we should add a new function for this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
BTW, I'm confused, we are in VhostKernBackend
why checking for vhost-user
feature?
@@ -386,6 +386,8 @@ bitflags! { | |||
const LOG_ALL = 0x400_0000; | |||
/// Feature flag for the protocol feature. | |||
const PROTOCOL_FEATURES = 0x4000_0000; | |||
/// Feature flag for packed virtqueue support (VIRTIO_F_RING_PACKED, bit 34). | |||
const RING_PACKED = 0x4_0000_0000; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this a virtio feature or a vhost-user feature?
@@ -79,7 +79,8 @@ pub trait VhostKernBackend: AsRawFd { | |||
|
|||
// Check if packed ring format is being used | |||
#[cfg(feature = "vhost-user")] | |||
let is_packed = config_data.flags & VhostUserVringAddrFlags::VHOST_VRING_F_PACKED.bits() != 0; | |||
let is_packed = |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why this change?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, please squash them where you add
@@ -3,6 +3,7 @@ | |||
## [Unreleased] | |||
|
|||
### Added | |||
- Add support for packed virtqueues in vhost-user and vhost-kern backends |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please follow the style, e.g. link to the pr, etc.
Summary of the PR
Adds support for packed virtqueues, implementing the VirtIO packed virtqueue format alongside the existing split virtqueue support. Packed virtqueues offer improved performance through better cache locality and reduced memory overhead compared to traditional split virtqueues.
Changes:
- Updated documentation to clearly distinguish between split and packed virtqueue address semantics
- For packed virtqueues: desc_table_addr becomes the packed descriptor ring, used_ring_addr becomes driver event suppression, avail_ring_addr becomes device event suppression
- Added RING_PACKED feature flag (bit 34, value 0x4_0000_0000)
- Added VHOST_VRING_F_PACKED vring flag (bit 1, value 0x2)
- Implemented packed virtqueue inflight I/O structures (DescStatePacked, QueueRegionPacked)
- Extended kernel backend to support packed virtqueue address configuration
- Added handling of packed layout in vring setup
- Added test_packed_virtqueue_features() to validate feature flag definitions
- Added test_packed_vring_addr_validation() to test packed virtqueue address validation/alignment
Requirements
Before submitting your PR, please make sure you addressed the following
requirements:
git commit -s
), and the commit message has max 60 characters for thesummary and max 75 characters for each description line.
test.
Release" section of CHANGELOG.md (if no such section exists, please create one).
unsafe
code is properly documented.